Energy-momentum tensor on the lattice: Nonperturbative renormalization in Yang-Mills theory