Also worth checking that ```width + x``` and ```height + y``` do not exceed ```r.getSizeX()``` and ```r.getSizeY()```?