Zimbabwe's Robert Mugabe has resigned as president after 37 years in power, as parliament began impeachment proceedings against him.