docs: def fitToSize(rect, targetWidth, targetHeight, bounds):
  	"""
  	Pads or crops a rectangle as necessary to achieve the target dimensions,
  	ensuring the modified rectangle falls within the specified bounds.
  	
  	The input rectangle, bounds, and return value are all a tuple of (x,y,w,h).
  	"""
  	
  	# Determine the difference between the current size and target size
  	x,y,w,h = rect
  	diffX = w - targetWidth
  	diffY = h - targetHeight
  	
  	# Determine if we are cropping or padding the width
  	if diffX > 0:
  		cropLeft  = math.floor(diffX / 2)
  		cropRight = diffX - cropLeft
  		x,y,w,h   = cropRect((x,y,w,h), 0, 0, cropLeft, cropRight)
  	elif diffX < 0:
  		padLeft  = math.floor(abs(diffX) / 2)
  		padRight = abs(diffX) - padLeft
  		x,y,w,h  = padRect((x,y,w,h), 0, 0, padLeft, padRight, bounds, False)
  	
  	# Determine if we are cropping or padding the height
  	if diffY > 0:
  		cropTop    = math.floor(diffY / 2)
  		cropBottom = diffY - cropTop
  		x,y,w,h    = cropRect((x,y,w,h), cropTop, cropBottom, 0, 0)
  	elif diffY < 0:
  		padTop    = math.floor(abs(diffY) / 2)
  		padBottom = abs(diffY) - padTop
  		x,y,w,h   = padRect((x,y,w,h), padTop, padBottom, 0, 0, bounds, False)
  	
  	return (x,y,w,h)