def rectangleSelect(x1, y1, x2, y2, ts):
	"""
	Returns the coordinates of a rectangle whose edges are snapped to the
	divisions between tiles. The returned value is in pixel units in the form
	(x, y, w, h)
	@type x1: int
	@param x1: left x-coordinate in tiles
	@type y1: int
	@param y1: top y-coordinate in tiles
	@type x2: int
	@param x2: right x-coordinate in tiles
	@type y2: int
	@param y2: bottom y-coordinate in tiles
	@type ts: int
	@param ts: size of tile in pixels
	"""
	rx = min(x1, x2) * ts
	ry = min(y1, y2) * ts
	rw = (abs(x2 - x1) + 1) * ts
	rh = (abs(y2 - y1) + 1) * ts
	return int(rx), int(ry), int(rw), int(rh)