Background

<?php
$image = new imagick( "opossum.jpg" );
$points = array(
0,0, 25,25, # top left
176,0, 126,0, # top right
0,135, 0,105, # bottom right
176,135, 176,135 # bottum left
);
$image->setimagebackgroundcolor("blue");
$image->setImageVirtualPixelMethod( imagick::VIRTUALPIXELMETHOD_BACKGROUND );
$image->distortImage( Imagick::DISTORTION_PERSPECTIVE, $points, TRUE );
header( "Content-Type: image/jpeg" );
echo $image;
?>
Edge

<?php
$image = new imagick( "opossum.jpg" );
$points = array(
0,0, 25,25, # top left
176,0, 126,0, # top right
0,135, 0,105, # bottom right
176,135, 176,135 # bottum left
);
$image->setImageVirtualPixelMethod( imagick::VIRTUALPIXELMETHOD_EDGE );
$image->distortImage( Imagick::DISTORTION_PERSPECTIVE, $points, TRUE );
header( "Content-Type: image/jpeg" );
echo $image;
?>
Mirror

<?php
$image = new imagick( "opossum.jpg" );
$points = array(
0,0, 25,25, # top left
176,0, 126,0, # top right
0,135, 0,105, # bottom right
176,135, 176,135 # bottum left
);
$image->setImageVirtualPixelMethod( imagick::VIRTUALPIXELMETHOD_MIRROR );
$image->distortImage( Imagick::DISTORTION_PERSPECTIVE, $points, TRUE );
header( "Content-Type: image/jpeg" );
echo $image;
?>
Tile

<?php
$image = new imagick( "opossum.jpg" );
$points = array(
0,0, 25,25, # top left
176,0, 126,0, # top right
0,135, 0,105, # bottom right
176,135, 176,135 # bottum left
);
$image->setImageVirtualPixelMethod( Imagick::VIRTUALPIXELMETHOD_TILE );
$image->distortImage( Imagick::DISTORTION_PERSPECTIVE, $points, TRUE );
header( "Content-Type: image/jpeg" );
echo $image;
?>
Transparent

<?php
$image = new imagick( "opossum.jpg" );
$points = array(
0,0, 25,25, # top left
176,0, 126,0, # top right
0,135, 0,105, # bottom right
176,135, 176,135 # bottum left
);
$image->setImageVirtualPixelMethod( imagick::VIRTUALPIXELMETHOD_TRANSPARENT );
$image->distortImage( Imagick::DISTORTION_PERSPECTIVE, $points, TRUE );
header("Content-type: image/jpeg");
echo $image;
?>
^