Implement rotate and transpose