Properly handle wrap around for sprite drawing.