Simplified the process so far

-Removed the distance to the edge of rect method and the distance mod
method.

-Replaced with a method that gets the closest point on a rectangle.