Germany's parliamentary assembly has elected Frank-Walter Steinmeier, a Social Democrat, as the country's president.