# init
if ($p4 == 0) { # vertical
  $p0_max = $width;
  $p1_max = $height;
  }
else { # horizontal
  $p0_max = $height;
  $p1_max = $width;
  }
$p2_max = $end - $start;
$p2_min = 0;
$p8_max = $end - $start;
$p8_min = $start - $end;
