Simply parametrize the borders and look for the roots of the gradient in the interior of the function domain.