You've got four equations
$$y_i=a\cos(\omega(x_i-x_0))+y_0\;,$$
for $i$ from $1$ to $4$, in which $y_0$ and $a$ appear linearly and $\omega$ and $x_0$ appear transcendentally. (I'm writing $\omega$ where you wrote $f$, both because $f(x-x_0)$ is easily mistaken for a function application and because in physics $f$ usually denotes a frequency and angular frequencies are usually denoted by $\omega$.)
You can solve one of these, say for $i=4$, for $y_0$ and substitute into the others, which yields
$$y_0=y_4-a\cos(\omega(x_4-x_0))\;,$$
$$y_i=y_4+a\cos(\omega(x_i-x_0))-\cos(\omega(x_4-x_0))$$
for $i$ from $1$ to $3$. Then you can solve one of the remaining equations, say for $i=3$, for $a$ and substitute into the other two, which yields
$$a=\frac{y_3-y_4}{\cos(\omega(x_3-x_0))-\cos(\omega(x_4-x_0))}\;,$$
$$\frac{y_i-y_4}{\cos(\omega(x_i-x_0))-\cos(\omega(x_4-x_0))}=\frac{y_3-y_4}{\cos(\omega(x_3-x_0))-\cos(\omega(x_4-x_0))}\;,$$
$$(y_i-y_4)(\cos(\omega(x_3-x_0))-\cos(\omega(x_4-x_0)))=(y_3-y_4)(\cos(\omega(x_i-x_0))-\cos(\omega(x_4-x_0)))$$
for $i=1,2$. Now you can apply the angle difference formula for the cosine to separate out $\omega x_0$,
$$
\begin{eqnarray}
&&
(y_i-y_4)(\cos\omega x_3\cos\omega x_0+\sin\omega x_3\sin\omega x_0-\cos\omega x_4\cos\omega x_0-\sin\omega x_4\sin\omega x_0)
\\
&=&
(y_3-y_4)(\cos\omega x_i\cos\omega x_0+\sin\omega x_i\sin\omega x_0-\cos\omega x_4\cos\omega x_0-\sin\omega x_4\sin\omega x_0)\;,
\end{eqnarray}
$$
divide through by $\cos\omega x_0$ to express everything in terms of $\tan\omega x_0$,
$$
\begin{eqnarray}
&&
(y_i-y_4)(\cos\omega x_3+\sin\omega x_3\tan\omega x_0-\cos\omega x_4-\sin\omega x_4\tan\omega x_0)
\\
&=&
(y_3-y_4)(\cos\omega x_i+\sin\omega x_i\tan\omega x_0-\cos\omega x_4-\sin\omega x_4\tan\omega x_0)\;,
\end{eqnarray}
$$
solve for $\tan\omega x_0$,
$$\tan\omega x_0=\frac{
(y_i-y_4)(\cos\omega x_3-\cos\omega x_4)
-
(y_3-y_4)(\cos\omega x_i-\cos\omega x_4)
}{
(y_i-y_4)(\sin\omega x_3-\sin\omega x_4)
-
(y_3-y_4)(\sin\omega x_i-\sin\omega x_4)
}
\;,
$$
eliminate $\tan\omega x_0$,
$$
\begin{eqnarray}
&&
\frac{
(y_1-y_4)(\cos\omega x_3-\cos\omega x_4)
-
(y_3-y_4)(\cos\omega x_1-\cos\omega x_4)
}{
(y_1-y_4)(\sin\omega x_3-\sin\omega x_4)
-
(y_3-y_4)(\sin\omega x_1-\sin\omega x_4)
}\\
&=&
\frac{
(y_2-y_4)(\cos\omega x_3-\cos\omega x_4)
-
(y_3-y_4)(\cos\omega x_2-\cos\omega x_4)
}{
(y_2-y_4)(\sin\omega x_3-\sin\omega x_4)
-
(y_3-y_4)(\sin\omega x_2-\sin\omega x_4)
}\;,\end{eqnarray}
$$
multiply by the denominators and use
$$
\begin{eqnarray}
&(\cos\beta-\cos\alpha)(\sin\gamma-\sin\alpha)-(\cos\gamma-\cos\alpha)(\sin\beta-\sin\alpha)
\\
&=\sin(\alpha-\gamma)+\sin(\beta-\alpha)+\sin(\gamma-\beta)
\end{eqnarray}
$$
to simplify,
$$
\begin{eqnarray}
&&
(y_3-y_4)(y_3-y_4)(\sin(\omega(x_2-x_4))+\sin(\omega(x_4-x_1))+\sin(\omega(x_1-x_2)))
\\
&-&
(y_1-y_4)(y_3-y_4)(\sin(\omega(x_2-x_4))+\sin(\omega(x_4-x_3))+\sin(\omega(x_3-x_2)))
\\
&-&
(y_2-y_4)(y_3-y_4)(\sin(\omega(x_3-x_4))+\sin(\omega(x_4-x_1))+\sin(\omega(x_1-x_3)))
\\
&=&0\;,
\end{eqnarray}
$$
and divide through by $(y_3-y_4)$ and collect corresponding sines to recover the expected symmetry:
$$
\begin{eqnarray}
&&
(y_1-y_2)\sin(\omega(x_3-x_4))
+
(y_3-y_1)\sin(\omega(x_2-x_4))
+
(y_3-y_2)\sin(\omega(x_4-x_1))
\\
&+&
(y_3-y_4)\sin(\omega(x_1-x_2))
+
(y_1-y_4)\sin(\omega(x_2-x_3))
+
(y_2-y_4)\sin(\omega(x_3-x_1))
\\
&=&0\;,
\end{eqnarray}
$$
or, to put it more succinctly,
$$\sum_{\sigma\in A_4}(y_{\sigma(1)}-y_{\sigma(2)})\sin(\omega(x_{\sigma(3)}-x_{\sigma(4)}))=0\;,$$
where the permutations $\sigma$ run over all even permutations in the alternating group $A_4$.
This is a single transcendental equation for $\omega$ that you can solve using your favourite root finding algorithm; then you can substitute the value back up the chain to obtain
$$
x_0=\frac1\omega\arctan\frac{
(y_2-y_4)(\cos\omega x_3-\cos\omega x_4)
-
(y_3-y_4)(\cos\omega x_2-\cos\omega x_4)
}{
(y_2-y_4)(\sin\omega x_3-\sin\omega x_4)
-
(y_3-y_4)(\sin\omega x_2-\sin\omega x_4)
}
\;,
$$
$$a=\frac{y_3-y_4}{\cos(\omega(x_3-x_0))-\cos(\omega(x_4-x_0))}\;,$$
$$y_0=y_4-a\cos(\omega(x_4-x_0))\;.$$
P.S.: I just realized I introduced a spurious root $\omega=0$ in dividing through by $\cos(\omega(x_3-x_0))-\cos(\omega(x_4-x_0))$; you can find a non-trivial root by dividing through by $\omega$:
$$\frac1\omega\sum_{\sigma\in A_4}(y_{\sigma(1)}-y_{\sigma(2)})\sin(\omega(x_{\sigma(3)}-x_{\sigma(4)}))=0\;.$$
Note that the equation will typically have infinitely many roots, which are not artifacts but correspond to infinitely many sinusoidals that go through your four points; you'll need to have some idea which one of these you want, e. g. perhaps the lowest one.