The 27-year-old moved to the DW Stadium from MLS side Sporting Kansas City on a free transfer in January 2013.
The Honduras international, who is a United States citizen, featured in all three of his country's World Cup matches in Brazil this summer.
"Roger came twice to me and wanted to leave the club. He wanted to go back to Kansas," Rosler told BBC Radio Manchester. "I think after he came back after the World Cup he struggled to find an appetite for football.
"His family is in the States, it was very difficult. I have never dealt with a player who has been at a World Cup, and I think for Roger it was a new experience. He came back and wanted to go back to Kansas, he was homesick.
"I said 'I can't let you go Roger, not now,' because at that point me didn't have any players in the midfield. We've had a good talk about his future and he is now in a good spirit."
Espinoza has made just one appearance for the Championship club this season.