The change comes at a challenging time for the social networking giant.