Modular variables in quantum theory