function copy_contents_within_polygon(canvas, points, x_min, y_min, x_max, y_max) {
	// Copy the contents of the given canvas within the polygon given by points bounded by x/y_min/max
	x_max = Math.max(x_max, x_min + 1);
	y_max = Math.max(y_max, y_min + 1);
	const width = x_max - x_min;
	const height = y_max - y_min;

	// @TODO: maybe have the cutout only the width/height of the bounds
	// const cutout = make_canvas(width, height);
	const cutout = make_canvas(canvas);

	cutout.ctx.save();
	cutout.ctx.globalCompositeOperation = "destination-in";
	draw_polygon(cutout.ctx, points, false, true);
	cutout.ctx.restore();

	const cutout_crop = make_canvas(width, height);
	cutout_crop.ctx.drawImage(cutout, x_min, y_min, width, height, 0, 0, width, height);

	return cutout_crop;
}
@param {HTMLCanvasElement} canvas
@param {{x: number, y: number}[]} points
@param {number} x_min
@param {number} y_min
@param {number} x_max
@param {number} y_max
@returns {PixelCanvas}