New function rotateCardinalDirection()