I thought this problem had a trivial solution, couple of for loops and some fancy counters, but apparently it is rather more complicated.
So my question is, how woul
I would shift the rows like so:
1 2 3 x x x 4 5 6 x x x 7 8 9
And just iterate the columns. This can actually be done without physical shifting.