Neutrinoless double-β (0νββ) decay of certain atomic isotopes, if observed, will have significant implications for physics of neutrinos and models of physics beyond the Standard Model. In the simplest scenario, if the mass of the light neutrino of the Standard Model has a Majorana component, it can mediate the decay. Systematic theoretical studies of the decay rate in this scenario, through effective field theories matched to ab initio nuclear many-body calculations, are needed to draw conclusions about the hierarchy of neutrino masses, and to plan the design of future experiments. However, a recently identified short-distance contribution at leading order in the effective field theory amplitude of the subprocess nn → pp (ee) remains unknown, and only lattice quantum chromodynamics (QCD) can directly and reliably determine the associated low-energy constant. While the numerical computations of the correlation function for this process are underway with lattice QCD, the connection to the physical amplitude, and hence this short-distance contribution, is missing. A complete framework that enables this complex matching is developed in this paper. The complications arising from Euclidean and finite-volume nature of the corresponding correlation function are fully resolved, and the value of the formalism is demonstrated through a simple example. The result of this work, therefore, fills the gap between first-principle studies of the nn → pp (ee) amplitude from lattice QCD and those from effective field theory, and can be readily employed in the ongoing lattice-QCD studies of this process.