proper math for viewport fitting