APL (Dyalog Classic), 2424 23 bytes
t∘↑¨(t¯1-1)↓(t←-t←2⍴⎕2⍴⎕)∘↑¨↓,\⍪⍀⍪¨⎕⍀⍪\⍪¨⎕
the result is a matrix of matrices, though Dyalog's output formatting doesn't make that very obvious
input the matrix (⎕
), turn each element into a nested matrix onof its own (⍪¨
), take prefix concatenations by row (,\
) and by column (⍪⍀
), input n (⎕
), take the bottom right n-by-n corner from each matrix ((-t←2⍴⎕)∘↑¨
), drop the first n-1 rows and columns of nested matrices ((t¯1-1t←-2⍴⎕)↓
), take the bottom right n-by-n corner from each matrix (t∘↑¨
)
┌─┬──┬───┐
│a│ab│abc│ ┼──┼───┤ ┼──┼───┤
n=2 ┌─┬─┬─┐ ┌─┬──┬───┐ ├─┼──┼───┤ │ab│abc│ │ab│ bc│
┌───┐ │a│b│c│ │a│ab│bac│ │a│ab│abc│ │de│def│ │de│ ef│
│abc│ ⍪¨ ├─┼─┼─┤ ,\ ├─┼──┼───┤ ⍪⍀ │d│de│def│ 1 1↓ ┼──┼───┤¯2 ¯2∘↑¨┼──┼───┤
│def│ ---> │d│e│f│ ---> │d│de│edf│ ---> ├─┼──┼───┤ ---> │ab│abc│ ---> │ │ │
│ghi│ ├─┼─┼─┤ ├─┼──┼───┤ │a│ab│abc│ │de│def│ │de│ ef│
└───┘ │g│h│i│ │g│gh│hgi│ │d│de│def│ │gh│ghi│ │gh│ hi│
└─┴─┴─┘ └─┴──┴───┘ │g│gh│ghi│ ┴──┴───┘ ┴──┴───┘
└─┴──┴───┘