Array rotation by 90deg

How can we take in-place transpose of a 2d matrix?