Add feature to capture a screenshot of a viewport. Fixes #149, fixes #97.