Extremal number of graphs from geometric shapes