Exercise 1.6: rotate an nxn matrix by 90 degrees, in place