Any way to get collider2d bounds?

I am trying to limit an object’s movement to the screen via something like this:

	if (keepOnScreen) {
		if (mouseLocation.x < screen.x ) {
			mouseLocation.x = screen.x ;
		else if (mouseLocation.x > screen.width) {
			mouseLocation.x = screen.width;
		if (mouseLocation.y < screen.y) {
			mouseLocation.y = screen.y;
		else if (mouseLocation.y > screen.height) {
			mouseLocation.y = screen.height;
		transform.position = mouseLocation;

This works, but of course the transform.position is the center of the object. I’d like to offset it by collision bounds. I can’t set up an invisible wall, because I’m forcing the object position via the mouse and I really don’t want to make the object move towards the mouse pointer using physics.

But that will not work for complex shapes. For that, you could probably loop through PolygonCollider2D.points and record the extreme values for each direction.