Thermodynamic transformations of nonequilibrium states