Clipping calculations didn't take viewport into account