Surface-confined [2 + 2] cycloaddition towards one-dimensional polymers featuring cyclobutadiene units.