This paper is on further development of discrete complex analysis introduced by R. Isaacs, J. Ferrand, R. Duffin, and C. Mercat. We consider a graph lying in the complex plane and having quadrilateral faces. A function on the vertices is called discrete analytic, if for each face the difference quotients along the two diagonals are equal. We prove that the Dirichlet boundary value problem for the real part of a discrete analytic function has a unique solution. In the case when each face has orthogonal diagonals we prove that this solution uniformly converges to a harmonic function in the scaling limit. This solves a problem of S. Smirnov from 2010. This was proved earlier by R. Courant-K. Friedrichs-H. Lewy and L. Lusternik for square lattices, by D. Chelkak-S. Smirnov and implicitly by P.G. Ciarlet-P.-A. Raviart for rhombic lattices. In particular, our result implies uniform convergence of the finite element method on Delaunay triangulations. This solves a problem of A. Bobenko from 2011. The methodology is based on energy estimates inspired by alternating-current network theory.