Algorithm: Given a large semiprime number N, find the smallest value of $A$ such that $N + A^2$ is a square
In your example, let $N = 299$, $A^2 = 324$, and $B^2 = 25$.
Then we have $N + B^2 = A^2$.
Thus $N = A^2 - B^2 = (A - B) \cdot (A + B)$.

What's left is to look at the pairs of divisors of $N$.
If $N = X \cdot Y$, we have $A - B = X$ and $A + B = Y$.
So $A = (Y + X) / 2$ and $B = (Y - X) / 2$.

The simple formulas above suggest that there is a tight and straightforward relation between this question and the general case of integer factorization.
Looks like one is not easier or harder than the other.
In particular, in you can factor $N$, then you can solve your problem.  Conversely, if there's a fast solution to your problem, it helps factor $N$.
So, while the formulation as in the question may help, it's still very close to a long-standing hard problem.

Note that Fermat's factorization method is based on the representation of an odd integer as the difference of two squares, much like this question is.
(Link suggested by Apass.Jack)