Rotating a matrix is a combination of 2 transformations:
Reverse the rows.
Diagnal flip. (Swap a[i][j] and a[j][i])