Suppose that $f$ is continuous on the closed square $\{x+iy:|x|\leq 1,|y|\leq1\}$, and analytic on the corresponding open square. Suppose also that $f(z)=0$ when $Re(z)=1$.
My task is to show that $f$ is identically zero on the closed square. Here is what I tried.
Define $g(z)=f(z)f(iz)f(-z)f(-iz)$ on the closed square $\{x+iy:|x|\leq 1,|y|\leq1\}$. With some work, I have mangaged to show that $g \equiv 0$ on the closed square. I suspect that this fact will make it relatively easy to prove that $f\equiv 0$ as well but, alas, I have not been able to do it yet. I have tried doing a proof by contradiction where we assume that $f$ is non-constant on $G$, in which case $f$ is maximized by some point on the boundary but not inside $G$, but I fail to see how to derived a contradiction from this.
Your approach is correct, and you are almost done. If $g(z)=f(z)f(iz)f(-z)f(-iz)$ is identically zero in the open unit square, then one of the four factors must have more than countably many zeros, and consequently is identically zero.
Generally, if $f$ and $g$ are holomorphic function in a (connected) domain $D$, and their product is identically zero in $D$, then one of $f$ or $g$ must be identically zero in $D$.