I think it might be need to use sampler2D
rather than sampler2DRect
, although always useful to specify what not working means!
Also you might need to be aware of the texture matrix for the PImage - see this issue which is still outstanding (but fixed in PraxisLIVE) - https://github.com/processing/processing/issues/3437