Band-gap engineering of functional perovskites through quantum confinement and tunneling