See the matrix as a set of nested squares. You can rotate each square independently. To rotate a square by N positions, you can rotate it N times by one position. To rotate by one position, save one element to extra storage, shift the others circularly and put back the saved element.
A B C D E
P F
O G
N H
M L K J I
- B C D E A
P F
O G
N H
M L K J I
B C D E - A
P F
O G
N H
M L K J I
B C D E F A
P G
O H
N I
M L K J -
B C D E F A
P G
O H
N I
- M L K J
B C D E F A
- G
P H
O I
N M L K J
B C D E F
A G
P H
O I
N M L K J