Adjust rectangle position by min-distance