Find the largest N digit number in a W by H grid of digits

CJam, 39 36 35 34 bytes

qN/)i\[{zW%_}4*]ff{_,@e<ew:i}e_:e>

Just quickly, before @Dennis wakes up :P

Try it online.

Explanation

The basic algorithm is to take all four rotations of the grid and split each row into chunks of length N (or the row length, whichever's smaller). Then convert the chunks to ints and take the largest.

qN/             Split input by newlines, giving an array of lines
)i\             Drop N from the array and put at bottom
[        ]      Wrap in array...
 {    }4*         Perform 4 times...
  zW%_              Rotate grid anticlockwise and push a copy
                Note that this gives an array of 5 grids [CCW1 CCW2 CCW3 CCW4 CCW4]
ff{         }   For each grid row, mapping with N as an extra parameter...
   _,             Push length of row
     @e<          Take min with N
        ew        Split into chunks
          :i      Convert to ints
e_              Flatten that array
:e>             Take cumulative max