  Two-dimensional election gases (2DEG), arising due to quantum confinement at
interfaces between transparent conducting oxides, have received tremendous
attention in view of electronic applications. The challenge is to find a
material system that exhibits both a high charge-carrier density and mobility,
at and even above room temperature. Here, we explore the potential of
interfaces formed by two lattice-matched wide-gap oxides of emerging interest,
$\textit{i.e.}$, the polar, orthorhombic perovskite LaInO$_{3}$ and the
non-polar, cubic perovskite BaSnO$_{3}$, employing density-functional theory
and many-body theory. We demonstrate that this material combination exhibits
all the key features for reaching the goal. For periodic heterostructures, we
find that the polar discontinuity at the interface is mainly compensated by
electronic relaxation through charge transfer from the LaInO$_{3}$ to the
BaSnO$_{3}$ side. This leads to the formation of a 2DEG hosted by the
highly-dispersive Sn-$s$-derived conduction band and a 2D hole gas of O-$p$
character, strongly localized inside LaInO$_{3}$. Remarkably, structural
distortions through octahedra tilts induce a depolarization field counteracting
the polar discontinuity, and thus increasing the $critical$ (minimal)
LaInO$_{3}$ thickness, $t_c$, required for the formation of a 2DEG. These polar
distortions decrease with increasing LaInO$_{3}$ thickness, enhancing the polar
discontinuity and leading to a 2DEG density of 0.5 electron per unit-cell
surface. Interestingly, in non-periodic heterostructures, these distortions
lead to a decrease of $t_c$, thereby enhancing and delocalizing the 2DEG. We
rationalize how polar distortions, termination, and thickness can be exploited
in view of tailoring the 2DEG characteristics, and why this material is
superior to the most studied prototype LaAlO$_{3}$/SrTiO$_{3}$.
