Can GIMP be used to create a perspective crop on a photo?

I photograph artists’ paintings. The resulting photo always has a background that must be removed, and the image of the painting itself should be the complete painting. All the paintings I photo are rectangular originally, so the final image of the painting should be also. These paintings will be for publication.
In Adobe PhotoShop, on the home page, one can open the original photograph and surround the painting with a relaxed dashed line on the photograph which will not touch the painting (and will not be a rectangle!). Be sure the “perspective box” is checked and click on the check mark to do a perspective crop that will remove most of the background. The software will put the resulting photo into a rectangle.
One can now do another perspective crop by placing the cursor at one corner of the painting and carefully run a dashed line along the border of the painting and the remaining corners of the painting. This shape will not be a perfect rectangle. The resulting dashed line should be the perfect match between the outer edge of the painting itself and the rest of the background. If one now clicks on the check mark, the software will do another perspective crop, and the remaining photo should only contain the painting you want. You may need to do this again if you are very particular and if some background still shows.

My question is: Can GIMP do this or some procedure that gives the same result?

Thank you and best regards, Warren

If I am understanding you correctly you want to undistort an image that is not taken straight on. If this is the case then GIMP has great tools for this. The handle transform tool may be best. Also make sure lens correction is applied to remove pincushion or barrel distortion. 4.11. Handle Transform

If working with RAW files or even JPGs then Darktable has good lens correction tool, and perspective control tool to straighten images of paintings. But GIMP should meet your needs.

This looks like the Perspective tool in “Corrective” mode.

Caveat: one thing it doesn’t do (because it cannot tell) is respect the actual aspect ratio of the art, so the resulting image usually has to be scaled in one direction to restore this, from information obtained elsewhere.