putting it all together
almost-working copy
working except for ant image
rotation not working
use mod to prevent overflow