Getting subsection in freeform

Hello everyone,

i’m trying to get a part of an image/texture in a custom shape, and warp that part to another shape.

for example with this image,

trapezium

I want to get only the upper surface of the chair, and warp that surface to an exact rectangle.

Now im guessing that this process might begin by get the shape of that surface as an ofPath object, and have to go further something with the texture coordinates, to warp the image. But i’m still not sure how I should approach or start searching for this process.

Please share some clues to get this work, even only some keywords which i can start searching with.
Thanks.