From visco to perfect plasticity in thermoviscoelastic materials