Quantum States of Confined Atomic and Molecular Systems in a Basis of Explicitly Correlated Gaussians