How can I mask graphics to a resizable rectangle?

I have a feeling you might want to look at the nine argument version of image() for this - see Alternative to using get() in a big PGraphics
This looks promising. Thanks!