The deal, negotiated by the Obama administration, lifted sanctions on Tehran in exchange for curbs on its nuclear program.
He was responding to a July 22 warning from Rouhani that the USA should not "play with the lion's tail" and warned that any conflict with Iran would be the "mother of all wars".
Earlier, US Secretary of State Mike Pompeo launched his own rhetorical assault on Iran's leaders, promising unspecified backing for Iranians unhappy with their government.
The US has been unable to persuade China to cut Iranian oil imports, dealing a blow to President Donald Trump's efforts to isolate the Islamic Republic after his withdrawal from the 2015 nuclear accord.
Iran had hoped the lifting of sanctions would allow it to replace its aging commercial airline fleet, but the USA withdrawal has halted billion-dollar deals struck with Airbus and Boeing.
The United States has told other countries they must halt imports of Iranian oil starting in early November or face USA financial measures. Try respect: "for Iranians & for int'l commitments", he tweeted.
He cited both internal Iranian politics making it hard for Tehran to cooperate with Trump and US politics making it hard for Trump to sell anything less than full success back home. "If they want to meet, I'll meet".
European countries say they remain committed to the agreement, seeing it as the surest way to safeguard their national security.
But many USA allies believe that language is code for regime change.
Sanctions and diplomatic pressure could pile enough pressure on the regime that it comes to the negotiating table - something Trump has advocated for. The strait at the mouth of the Persian Gulf is crucial to global energy supplies as about a third of all oil traded at sea passes through it.
People in Shiraz, Isfahan, Mashhad, Karaj, Ahvaz, and Rasht joined the protests that started on Tuesday mainly in Karaj and Isfahan over high inflation and unemployment.
Iran has also been hit by falling salaries set against the rising cost of living, while water shortages and power outages have also hit the embattled country.
Late on Friday, riot police intervened to disperse about 500 people chanting slogans against the government in the town of Eshtehard, 100 km (60 miles) west of Tehran, Some protesters threw rocks and bricks and damaged a Shiite Muslim seminary, the semi-official news agency Fars reported.
But before that, the last time a sitting US president actually met with an Iranian leader was before the revolution when Jimmy Carter met with the Shah of Iran.