Dry run: layer-by-layer rotation of a 3x3 matrix
================================================

[1 2 3]
[4 5 6]
[7 8 9]

layer 0, i=0: left 7 -> top, bottom 9 -> left, right 3 -> bottom, top 1 -> right
    [7 2 1]
    [4 5 6]
    [9 8 3]
layer 0, i=1: left 4 -> top, bottom 8 -> left, right 6 -> bottom, top 2 -> right
    [7 4 1]
    [8 5 2]
    [9 6 3]
