implements rotate function for sprites