Exact upper bound on the sum of squared nearest-neighbor distances between points in a rectangle