We consider an inverse spectral problem on a quantum graph associated with the square lattice. Assuming that the potentials on the edges are compactly supported and symmetric, we show that the Dirichlet-to-Neumann map for a boundary value problem on a finite part of the graph uniquely determines the potentials. We obtain a reconstruction procedure, which is based on the reduction of the differential Schr"odinger operator to a discrete one. As a corollary of the main results, it is proved that the S-matrix for all energies in any given open set in the continuous spectrum uniquely specifies the potentials on the square lattice.