An in-plane photoelectric effect in two-dimensional electron systems for terahertz detection