如何在php imagemagick中指定所有四个角坐标的叠加图像

I am a beginner in Imagemagick / Imagick, so please bear with me. My issue looks rather simple, but I could not find a solution, or any help anywhere. Please take a look at the image below - I am trying to create an image, by specifying all four corners coordinates in pixels.

I looked at Affine Distortion but that function is too complicated for me, sometimes takes a while to be executed, and when it works - the results are very unpredictable (image rotation is wrong, there are parts of the image removed or misplaced, etc.) So if anyhow possible, I would not like to have to use Affine distortion.

Of course, if it is not possible to just specify each corner coordinates, a help in which direction I should be going is greatly appreciated. I would like to use Imagick, but if this is maybe better to do with GD or similar, I am open for that.

1]

Without seeing source images, and what the expected result would be, I would assume you are attempting Perspective distortion. Meaning you want to take an image, and transform the MBR coordinates to a predefined set of points.

If I'm given a 400x400 checkerboard image, and want to distort it to the points listed above, the following ImageMagick command would work.

convert -size 400x400 pattern:checkerboard \
        -virtual-pixel transparent \
        -mattecolor transparent \
        -distort Perspective '0,0 50,153  400,0 240,40 0,400 315,355 400,400 336,156' \
        distorted_checkerboard.png

distorted_checkerboard.png

The -distort Perspective '... point matrix ...' reads as the following

  Origin Point  => Finial Point
    0,  0       =>  50,153       (top left)
  400,  0       => 240, 40       (top right)
    0,400       => 315,255       (bottom left)
  400,400       => 336,155       (bottom right)