Iraq is offering to mediate between Saudi Arabia and Iran to end their dispute, which began when Riyadh executed a prominent Shia cleric.