I used what's in this page
Destination point given distance and bearing from start point
Formula:
lat2 = asin(sin(lat1)*cos(d/R) + cos(lat1)*sin(d/R)*cos(θ))
lon2 = lon1 + atan2(sin(θ)*sin(d/R)*cos(lat1), cos(d/R)−sin(lat1)*sin(lat2))
θ is the bearing (in radians, clockwise from north); d/R is the angular distance (in radians), where d is the distance travelled and R is the earth’s radius
For θ I used -45 degrees (in radians) for the "upper-left point" and 135 degrees for the "bottom-right" one
(I recently asked the same question in the math sitemath site)