Let $r$ be the average of the primes:
$$r = \frac{p+q}{2}$$
Then, $n = (r-1)(r+1) = r^2 - 1$. In other words, $r^2 = n + 1$.
It follows that $r = \sqrt{n + 1}$, and given how we defined $r$, the prime factors $p$ and $q$ are trivial to find.
Edit:
Note that what Dan Brumleve mentions follows from this (assuming $p$ is the smaller prime):
$n + 1$ is a perfect square, so
$$\lfloor \sqrt{n+1} \rfloor = \sqrt{n+1} = r$$
and
$$\lfloor \sqrt{n} \rfloor = r - 1 = p$$
The method I suggested also works for integers $n$ with prime factors $p, q$ whose difference is an arbitrary positive integer $a$; that is, the method is not limited to twin primes.
In the general case, $r$ is defined like before, but the way it relates to $n$ is a little different (same idea though), namely as follows.
$$n = \left(r - \frac{a}{2}\right)\left(r + \frac{a}{2}\right) = r^2 - \frac{a^2}{4}$$
$$r^2 = n + \frac{a^2}{4}$$
$$r = \sqrt{n + \frac{a^2}{4}}$$
Assuming $p$ is the smaller prime factor, we have $p = r - \frac{a}{2}$ and $q = r + \frac{a}{2}$.