Atomically smooth hexagonal boron nitride (hBN) flakes have revolutionized two-dimensional (2D) optoelectronics. They provide the key substrate, encapsulant, and gate dielectric for 2D electronics while offering hyperbolic dispersion and quantum emission for photonics. The shape, thickness, and profile of these hBN flakes affect device functionality. However, researchers are restricted to simple, flat flakes, limiting next-generation devices. If arbitrary structures were possible, enhanced control over the flow of photons, electrons, and excitons could be exploited. Here, we demonstrate freeform hBN landscapes by combining thermal scanning-probe lithography and reactive-ion etching to produce previously unattainable flake structures with surprising fidelity. We fabricate photonic microelements (phase plates, grating couplers, and lenses) and show their straightforward integration, constructing a high-quality optical microcavity. We then decrease the length scale to introduce Fourier surfaces for electrons, creating sophisticated Moiré patterns for strain and band-structure engineering. These capabilities generate opportunities for 2D polaritonics, twistronics, quantum materials, and deep-ultraviolet devices.