  In this paper, we derive a general formula for the quantized fractional
corner charge in two-dimensional C_n-symmetric higher-order topological
insulators. We assume that the electronic states can be described by the
Wannier functions and that the edges are charge neutral, but we do not assume
vanishing bulk electric polarization. We expand the scope of the corner charge
formula obtained in previous works by considering more general surface
conditions, such as surfaces with higher Miller index and surfaces with surface
reconstruction. Our theory is applicable even when the electronic states are
largely modulated near system boundaries. It also applies to insulators with
non-vanishing bulk polarization, and we find that in such cases the value of
the corner charge depends on the surface termination even for the same bulk
crystal with C_3 or C_4 symmetry, via a difference in the Wyckoff position of
the center of the C_n-symmetric crystal.
